package eaa.tgi.scrum.services;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanFactoryService {
	
	//Singleton
	private static BeanFactoryService _instance;
	
	private ClassPathXmlApplicationContext appContext;
	
	private BeanFactoryService() {
		appContext = (ClassPathXmlApplicationContext) new ClassPathXmlApplicationContext("appContext.xml");
	}
	
	public static Object getBean(String beanName) {
		
		if(_instance == null) { 
			_instance = new BeanFactoryService();
		}
		
		return _instance.appContext.getBean(beanName);
	}
}